/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ControlLager;
import ModelLager.*;
import DBLager.*;
import java.util.ArrayList;

/**
 *
 * @author Alex Ly
 */
public class CustomerPCTR 
{
    private IFDbCustomerP dbCustomer;
    
    public CustomerPCTR()
    {
       dbCustomer = new DbCustomerP();
    }
    
    public CustomerP findCustomerP(int customerID)
    {
        return dbCustomer.findCustomerP(customerID, false);
    }
    
    public int createCustomer(String name, String address, String zipcode, String phoneNo, String country, int customerID, Double discount, Double bonusSystem)
    {
        CustomerP cObj = new CustomerP(name, address, zipcode, phoneNo, country, customerID, discount, bonusSystem);
        return dbCustomer.insertCustomerP(cObj, false);
    }
    
    public int updateCustomerP(String name, String address, String zipcode, String phoneNo, String country, int customerID, Double discount, Double bonusSystem)
    {
        CustomerP cObj = new CustomerP();
        cObj.setName(name);
        cObj.setAddress(address);
        cObj.setZipCode(zipcode);
        cObj.setPhoneNo(phoneNo);
        cObj.setCountry(country);
        cObj.setCustomerID(customerID);
        cObj.setDiscount(discount);
        cObj.setBonusSystem(bonusSystem);
        
        return dbCustomer.updateCustomerP(cObj);
    }
    
    public int deleteCustomerP(int customerID)
    {
        return dbCustomer.deleteCustomerP(customerID);
    }
    
    public ArrayList<CustomerP> getAllCustomer()
    {
        return dbCustomer.getAllCustomer();
    }
}


